package karaokestrong.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import karaokestrong.excepcion.DAOExcepcion;
import karaokestrong.modelo.Cancion;
import karaokestrong.negocio.GestionCancion;

/**
 * Servlet implementation class DetalleCancionServlet
 */
@WebServlet("/DetalleCancionServlet")
public class DetalleCancionServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DetalleCancionServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try
		{
		String idcancion = request.getParameter("id");
		
		GestionCancion negocio = new GestionCancion();
		Cancion c = negocio.obtenerDetalleCancion(Integer.parseInt(idcancion));
		
		request.setAttribute("cancion", c);
		RequestDispatcher rd = request
				.getRequestDispatcher("/movil/detalleCancion.jsp");
		rd.forward(request, response);
		}
		catch(DAOExcepcion ex){
		
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
